home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DATATYPE.SWG / 0001_BIGARRAY.PAS.pas next >
Pascal/Delphi Source File  |  1993-05-28  |  1KB  |  50 lines

  1. {
  2. >Do you know if the 64k Array limit still holds True when compiling
  3. >under protected mode in BP7?
  4.  
  5. >...The answer is yes, however the limit is 64K (or 65,521 Bytes
  6. >to be more exact  ie: < 65,535 Bytes) per data element. (ie: You
  7. >can create an Array of 1..N of 64K elements, using an Array of
  8. >Pointers.)
  9.  
  10. >But you can do *that* in Real mode.
  11.  
  12.   ...Yes, but try building something like this:
  13. }
  14. Uses
  15.   Crt;
  16.  
  17. Type
  18.   ar_64K   = Array[1..65521] of Byte;
  19.   po_ar64K = ^ar_64K;
  20.   ar_Po64K = Array[1..200] of po_ar64K;
  21.  
  22. Var
  23.   by_Index : Byte;
  24.   Buffer   : ar_Po64K;
  25.  
  26. begin
  27.   ClrScr;
  28.   by_Index := 0;
  29.   While (MaxAvail > SizeOf(ar_64K)) do
  30.   begin
  31.     Inc(by_Index);
  32.     New(Buffer[by_Index]);
  33.     GotoXY(1,1);
  34.     ClrEol;
  35.     Write('Maximum Memory Available: ', MaxAvail);
  36.     Delay(300);
  37.   end;
  38. end.
  39. {
  40.   ...Using the DPMI HEAP (and calling the correct DPMI Function
  41.   to use your hard disk as virtual memory, unless you do have
  42.   16Mb in your PC) you can allocate all 200 64K chunks of memory.
  43.   With the "Real mode" HEAP, you'd be lucky to be able to allocate
  44.   9 of these 64K chunks.
  45.  
  46.   ...It also means that you can use this DPMI HEAP to run HUGE .EXE's,
  47.   as it can be used For either CODE or DATA. So you can forget about
  48.   overlays, as you won't need them anymore.
  49. }
  50.